package p1000;

import java.math.BigInteger;
import java.util.Scanner;

public class Main1996汉诺塔VI {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        while (n-- > 0) {
            int a = scanner.nextInt();

            BigInteger result = new BigInteger("1");
            for (int i = 0; i < a; i++) {
                result = result.multiply(new BigInteger("3"));
            }

            System.out.println(result);
        }
    }

}
